﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
    xmlns:Mvvm="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7"
	mc:Ignorable="d"
	x:Class="Tfs.OnTheRoad.Controls.FindWorkItemPanel"
    x:Name="FindWorkItemPane" MaxHeight="145">
    <StackPanel>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="FindWorkItemPanes" ic:ExtendedVisualStateManager.UseFluidLayout="True">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.5">
                        <VisualTransition.GeneratedEasingFunction>
                            <ExponentialEase EasingMode="EaseOut"/>
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Visible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FindWorkItemPane">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Invisible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FindWorkItemPane">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <VisualStateManager.CustomVisualStateManager>
            <ic:ExtendedVisualStateManager/>
        </VisualStateManager.CustomVisualStateManager>
        <toolkit:PerformanceProgressBar VerticalAlignment="Center" Height="10" IsIndeterminate="True"  Grid.ColumnSpan="2" Visibility="{Binding Processing, Converter={StaticResource BooleanToVisibilityConverter}}"></toolkit:PerformanceProgressBar>
        <Border Background="{StaticResource PhoneBackgroundBrush}" CornerRadius="25,0,25,0" Margin="8" BorderThickness="4" Opacity=".8" BorderBrush="{StaticResource PhoneAccentBrush}">            
            <Grid Margin="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Image Grid.Row="0" Grid.Column="0" Source="/Images/Search.png" Width="32"></Image>
                <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
                    <TextBlock Margin="10,0,0,0" Foreground="{StaticResource PhoneForegroundBrush}" FontWeight="Bold" FontSize="20" Text="Work Item ID" />
                    <Grid Margin="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBox x:Name="workItemId" MinWidth="150" Grid.Column="0" InputScope="TelephoneNumber" >
                        </TextBox>

                        <Button  Style="{StaticResource ButtonStyle}" Grid.Column="1" Content="Go">
                            <Interactivity:Interaction.Triggers>
                                <Interactivity:EventTrigger EventName="Click">
                                    <Mvvm:EventToCommand Command="{Binding NavigateToWorkItem}" CommandParameter="{Binding ElementName=workItemId,Path=Text}"></Mvvm:EventToCommand>
                                </Interactivity:EventTrigger>
                            </Interactivity:Interaction.Triggers>
                        </Button>

                    </Grid>
                </StackPanel>
            </Grid>
        </Border>
    </StackPanel>
</UserControl>